<?php
echo $header;
echo $column_left;
echo $column_right;
$width_content = '100%';
if (($column_left) && ($column_right)) {
    $width_content = '48%';
} elseif (($column_left) || ($column_right)) {
    $width_content = '74%';
}
$style = '';
if ($column_left) {
    $style .= '; margin-left:1%';
}
if ($column_right) {
    $style .= '; margin-right:1%';
}
?>
<div class="content" style="width:<?php echo $width_content . $style; ?>"><?php echo $content_top; ?>
    <div class="breadcrumb">
        <?php foreach ($breadcrumbs as $breadcrumb) { ?>
            <?php echo $breadcrumb['separator']; ?><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a>
        <?php } ?>
    </div>
    <ul data-role="listview" data-divider-theme="a">
        <li data-role="list-divider"><h1><?php echo $heading_title; ?></h1></li>
    </ul><br />
    <p><?php echo $text_description; ?></p>
    <p><?php echo $text_code; ?><br />
        <textarea cols="40" rows="5"><?php echo $code; ?></textarea>
    </p>
    <p><?php echo $text_generator; ?><br />
        <input type="text" name="product" value="" />
    </p>
    <p><?php echo $text_link; ?><br />
        <textarea name="link" cols="40" rows="5"></textarea>
    </p>
    <div class="buttons">
        <div class="right"><a data-role="button" href="<?php echo $continue; ?>" class="button"><span><?php echo $button_continue; ?></span></a></div>
    </div>
    <?php echo $content_bottom; ?></div>
<script type="text/javascript"><!--
    $('input[name=\'product\']').autocomplete({
        delay: 0,
        source: function(request, response) {
            $.ajax({
                url: 'index.php?route=affiliate/tracking/autocomplete&filter_name=' +  encodeURIComponent(request.term),
                dataType: 'json',
                success: function(json) {		
                    response($.map(json, function(item) {
                        return {
                            label: item.name,
                            value: item.link
                        }
                    }));
                }
            });
		
        },
        select: function(event, ui) {
            $('input[name=\'product\']').attr('value', ui.item.label);
            $('textarea[name=\'link\']').attr('value', ui.item.value);
						
            return false;
        }
    });
    //--></script> 
<?php echo $footer; ?>